<%@ page language="java"
	import="java.util.*,
	org.jfree.chart.ChartFactory,
	org.jfree.chart.plot.CategoryPlot,
	org.jfree.chart.JFreeChart,
	org.jfree.chart.plot.PlotOrientation,
	org.jfree.chart.servlet.ServletUtilities,
	org.jfree.data.category.DefaultCategoryDataset,
	org.jfree.chart.axis.*,
	com.netitv.domain.*,
	org.jfree.chart.labels.StandardXYItemLabelGenerator,
	org.jfree.chart.renderer.category.BarRenderer3D,
	org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
	java.awt.*"
	contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/manager/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="../css/css_manager.css" rel="stylesheet" type="text/css" />

		<title>影视列表</title>
		<script type="text/javascript" src="./js/jquery-1.3.2.js"></script>
		<script language="javascript" type="text/javascript"
			src="./js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
			
		</script>
	</head>

	<body>

		<jsp:include page="/manager/common/head.jsp"></jsp:include>

		<!--  <form action="${ctx }/manager/analysisAction!channelAnalysis.do" method="post"
			id="filmForm" name="filmForm">-->
		<div style="margin: 0 auto; width: 960px;">
		<form action="${ctx }/manager/analysisAction!channelAnalysis.do">
			选择查询时间：
			<input name=selectTime id="endTime" size="15" onClick="WdatePicker()"
				value="<fmt:formatDate value='${endTime }' pattern='yyyy-MM-dd'/>" />
				<input type="submit" value="提交"/>
		</form>
		<select id="yyyy">
			<script type="text/javascript">
			var  d=new Date();
				for(var i=2013;i<=d.getFullYear();i++){
				document.write("<option value="+i+">"+i+"</option>");
				}
			</script> 
		</select>
		<select id="MM"><option>&nbsp;</option></select>
		<select id="dd"><option>&nbsp;</option></select>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<select>
				<option>
					产品包统计
				</option>
				<option>
					地区分析
				</option>
				<option>
					点播分析
				</option>
			</select>
		</div>
		<div style="margin: 0 auto; width: 960px;">
		<%
			ArrayList<channel_orderDetail> cos=(ArrayList<channel_orderDetail> )request.getAttribute("chlist");
			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
			for(channel_orderDetail co:cos){
			dataset.addValue(co.getOrderDetailCount(), "广州", co.getChannelname());	
			}
			//八个参数的：图形的标题、X轴标题、Y轴标题、dataset就是CategoryDataset类的实例对象、显示标题、启用热键、启用超键接						
			JFreeChart chart = ChartFactory.createBarChart3D("产品包销量统计","产品包","销量",dataset,PlotOrientation.VERTICAL,true, true,true);			
			chart.getTitle().setFont(new Font("楷体", Font.HANGING_BASELINE, 14));
			chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));//底部乱码
			CategoryPlot plot = chart.getCategoryPlot();
			BarRenderer3D renderer = new BarRenderer3D();
			
			renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); 
		    renderer.setBaseItemLabelsVisible(true); 
		    renderer.setBaseItemLabelPaint(Color.BLUE);
			plot.setRenderer(renderer);
			
			
			CategoryAxis domainAxis = plot.getDomainAxis();
			NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis();
			numberaxis.setTickMarksVisible(true);
			numberaxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 11));
			numberaxis.setLabelFont(new Font("黑体", Font.LAYOUT_RIGHT_TO_LEFT, 12));
			domainAxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 11));
			domainAxis.setLabelFont(new Font("黑体", Font.PLAIN, 12));
			String filename = ServletUtilities.saveChartAsPNG(chart, 400, 200, null, session);			
			String graphURL = request.getContextPath() + "/DisplayChart?filename=" + filename;
		%>
	<img src="<%=graphURL%>" width=500 height=300 border=0 usemap="#<%= filename %>">
		</div>
		<!--  </form>-->

		<jsp:include page="/manager/common/footer.jsp"></jsp:include>

	</body>
</html>